/*
 *
 * @ProjectName:    my_umi_app
 * @Package:
 * @ClassName:      statistics_api
 * @Description:    统计相关接口
 * @Author:         SuPeiSen
 * @CreateDate:     2021/3/5 12:36 上午
 * @UpdateDate:     2021/3/5 12:36 上午
 * @UpdateRemark:   更新说明：
 * @Version:        1.0
 */

import { Requests } from '@/utils/requests';
import { ApiPath } from '@/config/api_config';
import {
  AdStatisticsListType,
  ArticleStatisticsListType,
  StatisticsListType,
} from '@/type/statistics_type';

/**
 * 获取统计列表
 * @constructor
 */
export const GetStatisticsListApi = async (param: any) => {
  return await Requests.defaults.http<StatisticsListType>(
    'get',
    ApiPath.getStatisticsList,
  );
};

/**
 * 获取文章点击详情
 * @constructor
 * @param param
 */
export const GetArticleStatisticsDetailsApi = async (param: any) => {
  console.log(param);
  return await Requests.defaults.http<ArticleStatisticsListType>(
    'post',
    param.id
      ? ApiPath.getArticleStatisticsDetail
      : ApiPath.todayArticleStatisticsDetails,
    {
      postData: param,
    },
  );
};

/**
 * 获取广告点击详情
 * @constructor
 * @param param
 */
export const GetAdStatisticsDetailsApi = async (param: any) => {
  return await Requests.defaults.http<AdStatisticsListType>(
    'post',
    param.id ? ApiPath.getAdStatisticsDetail : ApiPath.todayAdStatisticsDetails,
    {
      postData: param,
    },
  );
};
